package com.gh.exception;


import com.gh.enums.HttpCodeEnum;
import lombok.NoArgsConstructor;


/**
 * @author heyu
 * @date 2022:11:06 10:00
 * 自定义异常，用于区分系统异常与用户友好提示
 */
@NoArgsConstructor
public class FruitException extends RuntimeException{
    /**
     * 错误的状态码
     */
    private Integer code=500;

    /**
     * 错误提示信息
     */
    private String message;

    public FruitException(String message){
        super(message);
        this.message = message;
    }

    public FruitException(Integer code, String message){
        super(message);
        this.code = code;
        this.message = message;
    }

    public FruitException(HttpCodeEnum codeEnum){
        super(codeEnum.getMessage());
        this.code = codeEnum.getCode();
        this.message = codeEnum.getMessage();
    }
}
